﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

namespace RealEstateCenter
{
    public partial class AddAgency : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            new login_check("estate_center");
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            SqlConnection sqlconnect = new SqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());
            SqlCommand cmd = new SqlCommand("insert into Agency(agency_username, agency_password , agency_name, agency_tel_no, agency_address , agency_mail , agency_city) values('" + agency_username.Text + "','" + agency_password.Text + "','" + agency_name.Text + "','" + agency_tel_no.Text + "','" + agency_address.Text + "','" + agency_mail.Text + "','" + agency_city.Text + "')", sqlconnect);
            sqlconnect.Open();
            int kontrol = cmd.ExecuteNonQuery();
            if (kontrol == 1)
            {
                Response.Redirect("ListAgencies.aspx");
            }
        }
    }
}